<?php
error_reporting(0);
define('TOTAL_WRITE', 2);
define('MC_HOST', 'localhost');
define('MC_PORT', 21211);

if (!class_exists('Memcache'))
{
    die('Cannot load memcache extension' . PHP_EOL);
}

$mc = new Memcache();
$mc->connect(MC_HOST, MC_PORT) or die('Cannot connect to id5db on ' . MC_HOST . ':' . MC_PORT . PHP_EOL);
for ($i = 0; $i < TOTAL_WRITE; $i ++)
{
    if (!$mc->set('key', 'Hello Kitty ' . $i) || !$mc->delete('key'))
    {
        die("Broken at item $i" . PHP_EOL);
    }
    
    if ($i % 1024 == 0)
    {
        echo "$i items synced already." . PHP_EOL;
    }
}
$mc->close();

return;

?>
